package com.powernode.service.impl;

import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;
import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.powernode.mapper.ProdCommMapper;
import com.powernode.domain.ProdComm;
import com.powernode.service.ProdCommService;
import org.springframework.util.StringUtils;

@Service
public class ProdCommServiceImpl extends ServiceImpl<ProdCommMapper, ProdComm> implements ProdCommService {
    @Autowired
    private ProdCommMapper prodCommMapper;

    @Override
    public Boolean replyAndExamineProdComm(ProdComm prodComm) {
        // 获取回复内容
        String replyContent = prodComm.getReplyContent();
        // 判断是否有回复内容
        if (StringUtils.hasText(replyContent)) {
            // 设置回复时间
            prodComm.setReplyTime(new Date());
            // 设置回复状态
            prodComm.setReplySts(1);
        }
        return prodCommMapper.updateById(prodComm) > 0;
    }
}